#pragma once

#include <QWidget>
#include "ui_UDPGroupContainer.h"

QT_BEGIN_NAMESPACE
namespace Ui { class UDPGroupContainerClass; };
QT_END_NAMESPACE

class UDPClient;
struct sockaddr_in;
class UDPGroupContainer : public QWidget
{
	Q_OBJECT

public:
	UDPGroupContainer(QWidget *parent = nullptr);
	~UDPGroupContainer();

private slots:

	void Tick();

	void on_InsertButton_clicked();

	void on_RemoveButton_clicked();

private:

	void OnUDPReceived(char* buffer, int len, sockaddr_in* remote);

	void OnGroupReceived(char* buffer, int len, sockaddr_in* remote, UDPClient* client);

private:
	Ui::UDPGroupContainerClass *ui;
	QTimer* timer = nullptr;
	int64_t lastts = 0;
};
